#ifndef _AUDIO_ENCODER_H_
#define _AUDIO_ENCODER_H_

#include <vorbis/vorbisenc.h>
#include "def.h"

class AudioEncoder
{
public:
	AudioEncoder(const int channels, const int sampleRate, const int quality);
	~AudioEncoder(void);

	PacketList*			headerPackets();
	PacketList*			encodeAudio(const TYPE_SAMPLE_IN **data, const int size);
	PacketList*			remainPackets();

	int					audioChannels() { return m_nAudioChannels; }
	int					audioSampleRate() { return m_nAudioSampleRate; }
	int					audioQuality() { return m_nAudioQuality; }

private:
	int					m_nAudioChannels;
	int					m_nAudioSampleRate;
	int					m_nAudioQuality;
	vorbis_info*		m_lpVorbisInfo;
	vorbis_dsp_state*	m_lpVorbisState;
	vorbis_block*		m_lpVorbisBlock;
	PacketList*			m_lpHeaderPackets;

	void				initVorbisInfo();
	void				initVorbisEncoder();
	void				uinitVorbisEncoder();
};

#endif // _AUDIO_ENCODER_H_
